using System;
using System.Collections.Generic;

namespace PluginFramework.Plugins
{
	public interface IPluginRepository
	{
		IList<string> GetActivePlugins();
		/// <summary>
		/// Saves active plugins
		/// </summary>
		/// <remarks>Implementation should accept empty lists</remarks>
		/// <param name="collection"></param>
		void UpdatePluginsState(IEnumerable<string> collection);
		
	}
		
	public class InMemoryRepository:IPluginRepository
	{
		
		public InMemoryRepository()
		{
#if RELEASE
			throw new NotSupportedException("This class is for testing/debug only!");
#endif
		}
		List<string> _db=new List<string>();

		public IList<string> GetActivePlugins()
		{
			return _db;
		}

		public void UpdatePluginsState(IEnumerable<string> collection)
		{
			if (collection == null) throw new ArgumentNullException("collection");
			_db.Clear();
			_db.AddRange(collection);
		}
	}
}